# 有三个办公室，8位老老师，8位老师随机分配到3个办公室
# 导入模块
import random
# 定义教室
office = [["办公室01"],["办公室02"],["办公室04"]]
# 定义老师名字
teacher = ["李一","李二","李三","李四","李武","李六","李琦","李八"]
for i in range(len(teacher)):
    office1 = random.randint(0,2)
    office[office1].append(teacher[i])

print(office)


# 求100以内能被3整除的数，并将作为列表输出
list1 = []
for i in range(1,100):
    if i % 3 == 0:
        list1.append(i)
print(list1)

# 列表[1,2,3,4,3,4,2,5,5,8,9,7],将此列表去重，得到一个唯一元素的列表  #不允许用强制类型转化
list1 = [1,2,3,4,3,4,2,5,5,8,9,7]
list2 = []
for i in list1:
    if list2.count(i) < 1:
        list2.append(i)
print(list2)

# 求斐波那契数列 1 1 2 3 5 8 13 ……
a = 1
b = 1
print(a,b,end=" ")
for i in range(100):
    c = a + b
    print(c,end=" ")
    a = b
    b = c

# 求100以内的质数（只能被1和它本身整除）
for i in range(2,100):
    for a in range(2,100):
        if i % a == 0:
            if i == a:
                print(i,end=" ")
            else:
                break

# 有一堆字符串“aabbbcddef”打印出不重复的字符串结果：cef #不允许用类型转化
str1 = "aabbbcddef"
for i in str1:
    if str1.count(i) <= 1:
        print(i,end="")

# 有一堆字符串，“welocme to super&Test”，打印出superTest，#不能查字符的索引
str1 = "welocme to super&Test"
list1 = str1.split(" ")
for i in list1:
    if "&" in i:
        print(i.replace("&",""))

# 有一堆字符串，“welocme to super&Test”，打印出tseT&repus ot ……全部单词原位置反转  #不允许用reverse
str1 = "welocme to super&Test"
for i in str1[::-1]:
    print(i,end="")

# 有一堆字符串，“abcdef”，将首尾反转，结果：fedcba，不能使用现有的函数或方法，自己写算法实现,不允许用步长
str1 = "abcdef"
for i in range(len(str1)):
    for a in range(len(str1)):
        if a != 0:
            c = i - a
            print(str1[c],end="")
    print(str1[i],end="")
    break


# 有一堆字符串，“aabbbcddef”，输出abcdef # 不允许用set
str1 = "aabbbcddef"
list1 = []
for i in str1:
    if list1.count(i) < 1:
        list1.append((i))
print("".join(list1))